package com.delos.hello.controller;

import com.alibaba.fastjson.JSON;
import com.delos.hello.vo.UserVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * @author zouyaowen
 * @date 2020-04
 */
@RestController
@Slf4j
public class TestController {
    @GetMapping("/getData")
    public UserVO getData() {
        UserVO userVO = new UserVO();
        userVO.setUserName("hello");
        userVO.setAge(22);
        userVO.setId(1);
        userVO.setPassword("123456");
        UserVO.InnerInfo innerInfo = new UserVO.InnerInfo();
        HashMap<String, UserVO.SpecificInfo> map = new HashMap<>();
        UserVO.SpecificInfo specificInfo = new UserVO.SpecificInfo();
        specificInfo.setType(3);
        specificInfo.setName("aaaaa");
        map.put("aaaaa", specificInfo);
        innerInfo.setMap(map);
        userVO.setInnerInfo(innerInfo);
        return userVO;
    }

    @PostMapping("/addData")
    public UserVO addData(UserVO userVO) {
        log.info("获取参数信息,userVO=[{}]", JSON.toJSONString(userVO));
        return userVO;
    }
}
